package Homework01;

import java.io.*;

public class housewokr01 {
    public static void main(String[] args) throws IOException {
        String directorypath = ("e:\\mytempt");
        File file = new File(directorypath);
        if(!file.exists()){
            //创建
            if(file.mkdirs()) {
                System.out.println("创建" + directorypath + "成功");
            }
                else{
                    System.out.println("创建失败");
                }}
                String filepath=directorypath+"\\work.txt";
                file=new File(filepath);
                if(!file.exists()){
                    if(file.createNewFile()){
                        if(file.exists()){
                            System.out.println(filepath+"文件创建成功");
                        }
                        else{
                            System.out.println(filepath+"文件创建失败");
                        }

                    }





        }
                //用字符输入流bufferedwriter 字符输入流写入内容
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));
                bw.write("王世杰最帅，11111");
                bw.close();
    }
}
